/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package definitions;

import org.pircbotx.Colors;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author tangd
 */
public class Definition {
    private String word;
    private String definition;
    private String definer;
    private long time;
    private SimpleDateFormat dateFormatter;

    public Definition(String word, String definition, String definer, long time) {
        this.word = word;
        this.definition = definition;
        this.definer = definer;
        this.time = time;
        dateFormatter = new SimpleDateFormat("M/d/y 'at' h:mm a");
    }

    public String getDefiner() {
        return definer;
    }

    public String getDefinition() {
        return definition;
    }

    public long getTime() {
        return time;
    }

    public String getWord() {
        return word;
    }
    public String toString() {
        if(definition!=null) {
            return Colors.BOLD+getWord()+": "+Colors.NORMAL+getDefinition();
        }
        return "No definition found for "+word;
    }
    public String whoDefString() {
        if(definer!=null) {
            
            return Colors.BOLD+"!whodef "+Colors.NORMAL+getWord()+" by "+getDefiner()+" at "+dateFormatter.format(new Date(getTime()));
        }
        return "No definition found for "+word;
    }
}
